Skip to content

fix(@angular/build): pass process environment variables to prerender workers#32731

Merged
alan-agius4 merged 1 commit intoangular:mainfrom
alan-agius4:prerender-env
Mar 11, 2026
Merged

fix(@angular/build): pass process environment variables to prerender workers#32731
alan-agius4 merged 1 commit intoangular:mainfrom
alan-agius4:prerender-env

Conversation

@alan-agius4
Copy link
Collaborator

Worker processes used for prerendering and route extraction now inherit process.env. This ensures that any custom environment variables required by the application are available during the server-side rendering process.

Closes #32730

@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label Mar 10, 2026
@alan-agius4 alan-agius4 requested a review from clydin March 10, 2026 11:16
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Mar 10, 2026
@alan-agius4 alan-agius4 changed the title fix(angular/build): pass process environment variables to prerender workers fix(@angular/build): pass process environment variables to prerender workers Mar 10, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to ensure worker processes inherit "process.env" for prerendering and route extraction, making custom environment variables available. However, a significant security vulnerability has been identified: passing the entire "process.env" to worker threads risks exposing sensitive build-time secrets (e.g., API keys, tokens) if they are inadvertently rendered into static HTML files. It is crucial to implement a filtering mechanism to pass only necessary environment variables, adhering to the principle of least privilege.

@alan-agius4 alan-agius4 removed the request for review from clydin March 10, 2026 21:02
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 10, 2026
…workers

Worker processes used for prerendering and route extraction now inherit `process.env`. This ensures that any custom environment variables required
by the application are available during the server-side rendering process.

Closes angular#32730
@alan-agius4 alan-agius4 merged commit 839c725 into angular:main Mar 11, 2026
10 of 11 checks passed
@alan-agius4 alan-agius4 deleted the prerender-env branch March 11, 2026 12:36
@alan-agius4
Copy link
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strict host header validation breaks route extraction

2 participants